<extend name="Public/base" />
<block name="content">
    <style>
        .layui-form-label{
            width:100px;
        }
    </style>
    <div class="layui-tab layui-tab-brief" lay-filter="demoTitle">
        <ul class="layui-tab-title site-demo-title">
            <li><a href="<{:U('Admin/index')}>">管理员列表</a></li>
            <li class="layui-this"><a href="<{:U('Admin/sys_config')}>">系统配置</a></li>
        </ul>
        <div class="layui-body layui-tab-content site-demo site-demo-body">
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                <legend>项目配置</legend>
            </fieldset>
            <form class="layui-form" action="" lay-filter="data-form">
                <div class="layui-form-item">
                    <label class="layui-form-label">项目名称</label>
                    <div class="layui-input-inline">
                        <input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入项目名称" class="layui-input" value="<{$config['title']}>">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">短信</label>
                    <div class="layui-input-inline">
                        <input type="checkbox" name="message" lay-skin="switch" value="1" lay-text="开启|关闭" <if condition="$config['message'] eq 1">checked</if> >
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">通知</label>
                    <div class="layui-input-inline">
                        <input type="checkbox" name="notice" lay-skin="switch" value="1" lay-text="开启|关闭" <if condition="$config['notice'] eq 1">checked</if> >
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="data-form">保存</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <script>

        layui.use('form', function(){
            var form = layui.form;

            form.on('submit(data-form)', function(data){
                $.post('__ACTION__', data.field, function(res){
                    //res就是返回的结果
                    if(res.status == '200'){
                        layer.msg(res.message, {icon: 1});
                        setTimeout(function(){
                            location.reload();
                        },1000);
                    } else {
                        layer.msg(res.message, {icon: 2})
                    }
                });
                return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
            });

        });
    </script>

</block>





